package bh;

import android.content.Context;
import yyee.llee.mmee.base_api_net.base_api_bean.bean.AirQualityStatus;
import yyee.llee.mmee.common.R;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class FX {

    /**
     * @param airQualityNumber 空气质量指数
     * @return 返回空气质量指数对应的字符串(" 优 ")，颜色具体数值以及背景圆圈id
     */
    public static AirQualityStatus getColorResourceByAirQualityNum(int airQualityNumber, Context context) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        String str = "优";
        int colorId = R.color.air_quality_status_1;
        int bgResourceId = R.drawable.shape_aqi_num_bg_1;
        if (airQualityNumber > 300) {
            str = "严重";
            colorId = R.color.air_quality_status_6;
            bgResourceId = R.drawable.shape_aqi_num_bg_6;
        } else if (airQualityNumber > 200) {
            str = "重度";
            colorId = R.color.air_quality_status_5;
            bgResourceId = R.drawable.shape_aqi_num_bg_5;
        } else if (airQualityNumber > 150) {
            str = "中度";
            colorId = R.color.air_quality_status_4;
            bgResourceId = R.drawable.shape_aqi_num_bg_4;
        } else if (airQualityNumber > 100) {
            str = "轻度";
            colorId = R.color.air_quality_status_3;
            bgResourceId = R.drawable.shape_aqi_num_bg_3;
        } else if (airQualityNumber > 50) {
            str = "良";
            colorId = R.color.air_quality_status_2;
            bgResourceId = R.drawable.shape_aqi_num_bg_2;
        }
        return new AirQualityStatus(context.getResources().getColor(colorId), str, bgResourceId);
    }

    /**
     * 判断当前日期是星期几
     *
     * @param pTime 设置的需要判断的时间  //格式如2021-04-20
     * @return dayForWeek 判断结果
     */
    public static String getWeek(String pTime) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        String Week = "周";
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        try {
            c.setTime(format.parse(pTime));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        if (c.get(Calendar.DAY_OF_WEEK) == 1) {
            Week += "日";
        }
        if (c.get(Calendar.DAY_OF_WEEK) == 2) {
            Week += "一";
        }
        if (c.get(Calendar.DAY_OF_WEEK) == 3) {
            Week += "二";
        }
        if (c.get(Calendar.DAY_OF_WEEK) == 4) {
            Week += "三";
        }
        if (c.get(Calendar.DAY_OF_WEEK) == 5) {
            Week += "四";
        }
        if (c.get(Calendar.DAY_OF_WEEK) == 6) {
            Week += "五";
        }
        if (c.get(Calendar.DAY_OF_WEEK) == 7) {
            Week += "六";
        }
        return Week;
    }
}
